{include file="common/header.tpl"}
<section class="main">
	<nav class="left-col">{include file="common/navi-education.tpl"}</nav>
    <article class="right-col">
    	<h2>{$arrSmarty.category[$smarty.get.type]}{if isset($smarty.session.education) && ($smarty.session.education&1<<1) > 0} &raquo; <a href="{$smarty.const.HOST_BACKEND}education/add?cate={$smarty.session.edupost.cate}&amp;prov={$smarty.session.edupost.prov}&amp;dist={$smarty.session.edupost.dist}&amp;type={$smarty.get.type}">Thêm mới</a>{/if}</h2>    
      	{include file="education/search.tpl"}
        <form name="frmEducation" id="frmEducation" action="{$smarty.const.HOST_BACKEND}education/act" method="post" enctype="multipart/form-data">
            <input type="hidden" name="paction" id="paction"/>
            {if $arrResult} 
                {if isset($smarty.session.education)}
                	<div class="s-button">
                        {if ($smarty.session.education&1<<4) > 0}
                        	<button type="button" onclick="javascript:confirmPending(this.form);">Tạm dừng</button>
                        {/if}  
                        {if ($smarty.session.education&1<<5) > 0}
                        	<button type="button" onclick="javascript:confirmActive(this.form);">Kích hoạt / Phục hồi</button>
                        {/if}                                                                                   
                        {if ($smarty.session.education&1<<3) > 0}  
                        	<button type="button" onclick="javascript:confirmDelete(this.form);">Xóa</button>
                            {if $AppUI->type > 2}
                            	<button type="button" onclick="javascript:confirmDeleteDb(this.form);">Xóa khỏi Db</button>
                            {/if}
                        {/if}
	               	 </div>
               	{/if}
                {if $intTotal > 0}
                    <div class="s-page">
                    	<strong class="total">Tổng số: {$intTotal}</strong>
                        {paging total=$intTotal limit=$intLimit offset=$intOffset url=$strUrl}
                    </div>
                {/if}
            {/if}
            <table width="100%" cellpadding="0" cellspacing="0" border="0" class="list">
                <thead>
                    <tr>
                        {if $arrResult && isset($smarty.session.education) && ( (($smarty.session.education&1<<3)>0) || (($smarty.session.education&1<<4)>0) )}
                            <th width="16"><input type="checkbox" name="pcheckall" id="pcheckall" onclick="javascript:checkAll(this.form,'peducateid[]',this.checked);"/></th>
                        {/if} 
                        <th width="170">Tên trường</th>   
                        <th>Thông tin</th> 
                        <th width="170">Địa chỉ</th> 
                        <th width="80">Trụ sở chính</th>
                        <th width="60">Tình trạng</th>
                        <th width="60">Ngày đăng</th>
                        {if $arrResult && isset($smarty.session.education)}
                            <th width="56">&nbsp;</th>
                        {/if}
                    </tr>
                </thead>
                <tbody>
                    {if $arrResult}
                        {foreach item=item from=$arrResult}
                            <tr class="{cycle values="odd,even"}">
                                {if isset($smarty.session.education) && ((($smarty.session.education&1<<3)>0) || (($smarty.session.education&1<<4)>0))}
                                    <td class="firstChild" align="center">
                                        <input type="checkbox" id="peducateid{$item.educateid}" name="peducateid[]" value="{$item.educateid}" onclick="javascript:checkOneItem(this.form, 'pcheckall')"/>
                                    </td>
                                    <td>{$item.name}</td>
                                {else}
                                    <td class="firstChild">{$item.name}</td>
                                {/if}
                                <td>
                                    <div>
                                        <span class="firstItem">Phân loại:</span>
                                        <span>{$item.category_name}</span>
                                    </div>
                                    <div class="topLine">
                                        <span class="firstItem">Kinh độ:</span>
                                        <span>{$item.longitude}</span>
                                    </div>
                                    <div class="topLine">
                                        <span class="firstItem">Vĩ độ:</span>
                                        <span>{$item.latitude}</span>
                                    </div>
                                    {if $item.website}
                                        <div class="topLine">
                                            <span class="firstItem">Website:</span>
                                            <span><a href="{$item.website}" target="_blank">{$item.website}</a></span>
                                        </div>
                                    {/if}
                                </td> 
                                <td>{$item.addr}, {$item.district_name}<br/>{$item.province_name}<br/>{$item.country_name}</td>
                                <td align="center">
                                    {if $item.parentid == 0}
                                        <img src="{$smarty.const.HOST_STATICS}backend/img/ad-accept.png" alt="Trụ sở chính" border="0" width="16" height="16" title="Trụ sở chính" />
                                    {else}
                                        <img src="{$smarty.const.HOST_STATICS}backend/img/ad-unaccept.png" width="16" height="" alt="Chi nhánh" border="0" title="Chi nhánh" />
                                    {/if}
                                </td>
                                <td align="center">
                                    {if $item.status == 0}
                                        <img src="{$smarty.const.HOST_STATICS}backend/img/ad-unaccept.png" width="16" height="" alt="Tạm dừng" border="0" title="Tạm dừng" />
                                    {elseif $item.status == 1}
                                         <img src="{$smarty.const.HOST_STATICS}backend/img/ad-accept.png" alt="Đang kích hoạt" border="0" width="16" height="16" />
                                    {elseif $item.status == 2}
                                        <img src="{$smarty.const.HOST_STATICS}backend/img/ad-cancel.png" alt="Bị xóa" border="0" width="16" height="16" />
                                    {/if}
                                </td>
                                <td align="center">{$item.postdate|date_format:"%d/%m/%Y"}<br/>{$item.postdate|date_format:"%H:%M:%S"}</td>
                                <td align="center">
                                    {if isset($smarty.session.education)}                                                    	{if $item.parentid == 0 && ($smarty.session.education&1<<1)>0}
                                            <a href="{$smarty.const.HOST_BACKEND}education/add?parentid={$item.educateid}" title="Thêm chi nhánh" ><img src="{$smarty.const.HOST_STATICS}backend/img/ad-add.png" alt="Thêm chi nhánh" border="0" width="16" height="16"/></a>
                                        {/if}
                                        {if ($smarty.session.education&1<<2)>0}
                                            <a href="{$smarty.const.HOST_BACKEND}education/edit?educateid={$item.educateid}&amp;type={$item.type}" title="Cập nhật thông tin">
                                                <img src="{$smarty.const.HOST_STATICS}backend/img/ad-edit.png" alt="Edit" border="0" width="16" height="16" />
                                            </a>
                                        {/if}
                                        <a href="{$smarty.const.HOST_BACKEND}education/cmt?eduid={$item.educateid}" title="Xem đánh giá - bình luận về trường" target="_blank"><img src="{$smarty.const.HOST_STATICS}backend/img/ad-comment.png" width="16" height="16" alt="" /></a>
                                    {else}
                                        &nbsp;
                                    {/if}
                                </td>
                            </tr>
                        {/foreach}
                    {else}
                        <tr><td colspan="7" align="center">Không có dữ liệu</td></tr>
                    {/if}
                </tbody>
            </table>
            {if $arrResult} 
            	{if $intTotal > 0}
                    <div class="s-page">
                    	<strong class="total">Tổng số: {$intTotal}</strong>
                        {paging total=$intTotal limit=$intLimit offset=$intOffset url=$strUrl}
                    </div>
                {/if}
                {if isset($smarty.session.education)}
                	<div class="s-button">
                        {if ($smarty.session.education&1<<4) > 0}
                            <button type="button" onclick="javascript:confirmPending(this.form);">Tạm dừng</button>
                        {/if}  
                        {if ($smarty.session.education&1<<5) > 0}
                            <button type="button" onclick="javascript:confirmActive(this.form);">Kích hoạt / Phục hồi</button>
                        {/if}                                                                                   
                        {if ($smarty.session.education&1<<3) > 0}  
                            <button type="button" onclick="javascript:confirmDelete(this.form);">Xóa</button>
                            {if $AppUI->type > 2}
                                <button type="button" onclick="javascript:confirmDeleteDb(this.form);">Xóa khỏi Db</button>
                            {/if}
                        {/if}
	               	 </div>
               	{/if}
            {/if}
        </form>
   	</article>
</section>
{include file="common/footer.tpl"}
                
